import threading
import time
from concurrent.futures import ThreadPoolExecutor

class TT:
    def __init__(self, v):
        self.value = v

    def __str__(self):
        return str(self.value)

def wait_on_b():
    time.sleep(5)
    print('b') # b will never complete because it is waiting on a.
    return 5

def task_a(p1, tt1):
    time.sleep(5)
    print(p1, tt1) # a will never complete because it is waiting on b.
    return p1*2


executor = ThreadPoolExecutor(max_workers=10)
tt1 = TT(8)

# 定义线程池
threads = []
for i in range(0,10):
    t = threading.Thread(target=task_a, args=(i, tt1))
    threads.append(t)
    t.start()
    #r = executor.submit(task_a, (i, tt1))
    # print(r)

    # 主线程中等待所有子线程退出
for t in threads:
    t.join()

#time.sleep(10)
print('end')